package com.shrct.businessprocess.project.impl;

import com.shrct.businessprocess.project.RCSaleCommissionYearPayment;
import com.shrct.businessprocess.project.RCSaleCommissionYearPaymentDAO;
import com.shrct.businessprocess.project.RCSalesAssignment;
import com.shrct.businessprocess.project.impl.RCSaleCommissionYearPaymentImpl;
import edu.fudan.mylang.pf.BaseDAOService;
import edu.fudan.mylang.pf.IGenericQuery;
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.springframework.stereotype.Service;

@Service("com.shrct.businessprocess.project.RCSaleCommissionYearPaymentDAO")
public class RCSaleCommissionYearPaymentDAOImpl extends BaseDAOService<RCSaleCommissionYearPayment> implements RCSaleCommissionYearPaymentDAO {
  public RCSaleCommissionYearPayment create(final Procedure1<? super RCSaleCommissionYearPayment> init) {RCSaleCommissionYearPayment rCSaleCommissionYearPayment=RCSaleCommissionYearPaymentImpl.create(getObjectFactory());
    final Procedure1<RCSaleCommissionYearPayment> _function = new Procedure1<RCSaleCommissionYearPayment>() {
        public void apply(final RCSaleCommissionYearPayment it) {
          init.apply(it);
          it.checkValid();
        }
      };
    RCSaleCommissionYearPayment _doubleArrow = ObjectExtensions.<RCSaleCommissionYearPayment>operator_doubleArrow(rCSaleCommissionYearPayment, _function);
    return _doubleArrow;
  }
  
  public void delete(final RCSaleCommissionYearPayment value) {getObjectFactory().delete(value);
    
  }
  
  public RCSaleCommissionYearPayment findSaleCommissionYearPayment(final Integer year, final RCSalesAssignment saler) {
    IGenericQuery<RCSaleCommissionYearPayment> query=getObjectFactory().createGenericQuery(RCSaleCommissionYearPayment.class,"select e from com.shrct.businessprocess.project.impl.RCSaleCommissionYearPaymentImpl as e   where (((e.year) = (:year)) and ((e.saler) = (:saler))) and  e.active = 1      ").setParameter("year",year).setParameter("saler",saler);
    RCSaleCommissionYearPayment _uniqueResult = query.uniqueResult();
    return _uniqueResult;
  }
}
